package com.itheima.test6;

public class GrilFriendTest {
    public static void main(String[] args) {
        GrilFriend[] gs = new GrilFriend[4];

        gs[0] = new GrilFriend("小红", 18, '女', "玩游戏");
        gs[1] = new GrilFriend("小明", 19, '女', "游泳");
        gs[2] = new GrilFriend("小月", 20, '女', "跑步");
        gs[3] = new GrilFriend("小张", 21, '女', "骑车");

        int sum = 0;
        for (int i = 0; i < gs.length; i++) {
            sum += gs[i].getAge();
        }

        int avg = sum / gs.length;
        int count = 0;
        for (int i = 0; i < gs.length; i++) {
            if(gs[i].getAge() < avg) {
                count++;
                System.out.println(gs[i].getName() + ", " + gs[i].getAge() + ", " + gs[i].getGender() + ", " + gs[i].getHobby());
            }
        }
        System.out.println(count);
    }
}
